<?php 
define('IN_ADAGPS', TRUE);
include_once('adagps.com/cfg.php');
include_once(CORE_PATH.'includes/summary_functions.php');
include_once(CORE_PATH.'database/commonDB.php'); 
if(!ConnectDB()) {
    die('Không kết nối được DATABASE');
}

$date1 = time()-(24 * 60 * 60);
$date1 = date('Y-m-d', $date1);

$sql =" select id from tbl_service where active = 1";
$arrService = $objDbUpdate->GetArray($sql);
$countService = count($arrService);

for($j=0;$j<$countService;$j++){
  $id = $arrService[$j]['id']; 
  summary_product($id,$date1) ;
  fm_summary($id,$date1,$date1);  
} 

$sql = "insert into tbl_history_summary(date_sum) value('$date1')";
$objDbUpdate->Execute($sql);
CloseDB();
?>
